

import { defineStore } from 'pinia';

import store from "@/store"
export const useUserStore = defineStore('user', () => {
      // 这里将登陆成功之后的用户数据做持久化存储
      const token = ref()
      const userName = ref()
      const nickName = ref()
      const avatar = ref()
      const roles = ref([])
      const expires_in = ref()
      const is_super = ref()
      const college_id=ref()
      const loginTime=ref()
      const rolesName=ref()
      const tenant_id = ref(null);
      const role_top = ref(null);

      return { token, userName, nickName, avatar, expires_in, roles, is_super,college_id,loginTime,rolesName,tenant_id,role_top}

}, {
      persist: {
            storage: sessionStorage
      }

})


export default useUserStore;

// 非setup
export function useUserStoreHook() {
      return useUserStore(store);
}